package com.ywgt.volatile_;

import java.util.concurrent.TimeUnit;

public class JMMTest {
    private volatile static int i=0;
    public static void main(String[] args) {
        new Thread(()->{
           while (i==0){

           }
        }).start();
        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        i=1;
        System.out.println(i);
    }
}
